package com.example.userservice.feign;

import com.example.userservice.model.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Permission服务Feign客户端
 */
@FeignClient(name = "permission-service")
public interface PermissionServiceClient {

    /**
     * 绑定默认角色（普通用户）
     */
    @PostMapping("/permission/bind-default-role")
    Result<Void> bindDefaultRole(@RequestParam("userId") Long userId);

    /**
     * 查询用户角色码
     */
    @GetMapping("/permission/user-role-code")
    Result<String> getUserRoleCode(@RequestParam("userId") Long userId);

    /**
     * 升级用户为管理员
     */
    @PostMapping("/permission/upgrade-to-admin")
    Result<Void> upgradeToAdmin(@RequestParam("userId") Long userId);

    /**
     * 降级用户为普通角色
     */
    @PostMapping("/permission/downgrade-to-user")
    Result<Void> downgradeToUser(@RequestParam("userId") Long userId);
}